<template>
  <div class="flex flex-col h-screen">
    <!-- header -->
    <my-header :user="userInfo"></my-header>

    <!-- content -->
    <div class="flex w-full h-full overflow-hidden">
      <!--  导航栏  -->
      <navigator :user="userInfo"></navigator>
      <!--  视频展示  -->
      <div class="w-full h-full overflow-y-scroll">
        <router-view/>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import {onBeforeMount, reactive, ref} from "vue";
import {getUserByToken} from "@/api/user";
import {useRouter} from "vue-router";

const router = useRouter()

const userInfo = reactive({});

//在初始化时验证token以获取用户id
onBeforeMount(async ()=>{
  const result = await getUserByToken()
  for (const key in result.data) {
    userInfo[key] = result.data[key]
  }
})
</script>

<style scoped>

</style>
